#include "driverView.h"
#include "camera/first_person_camera.h"

DriverView::DriverView(const Rectangle& viewport,SceneModel& model)
	: SceneView(viewport,model){
	Point tcenter = model.getTruck().getDimensions().center();

	float aspect = ((GLfloat) viewport.width()/(GLfloat) viewport.height());
	float fovUp  = 80.0f;
	float zNear  = 0.10f;
	float zFar   = 1500.0f;
	camera = new FirstPersonCamera(	tcenter+Point(0,1,0),tcenter,Point(0,0,1),
									fovUp,
									aspect ,
									zNear, zFar);
}

DriverView::~DriverView(){

}

void DriverView::setEnv(){
	glViewport ((GLint) viewport.x1,(GLint) viewport.y1, (GLsizei) viewport.width(), (GLsizei) viewport.height());
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
}

